﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>企业上架</title>
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/demo.css">
    <link href="~/Content/Styles/Manage_Order.css" rel="stylesheet" />
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.2/jquery.easyui.min.js"></script>
    <script src="~/Content/jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js"></script>
    <script src="~/Content/jquery-easyui-1.4.2/jquery.Jcrop.js"></script>
    <link href="~/Content/Script/jquery.Jcrop.css" rel="stylesheet" />
    <script>
        $(function () {
            var merid, boxid, boxstat, boxname;
            getmer();//加载操作员管理的所有商户
            $('#btnadd').linkbutton('disable');
            $('#btnedit').linkbutton('disable');
            $('#btndell').linkbutton('disable');
            $('#SearchBtn').linkbutton('disable');

        });

        ///获取操作员下面的商户
        function getmer() {
            $.ajax({
                url: '/BoxSet/getmer',
                dataType: 'json',
                success: function (res) {
                    var data = JSON.parse(res);
                    $('#searchMer').combobox({
                        data: data,
                        valueField: 'MerID',
                        textField: 'MerName',
                        onSelect: function (record) {
                            initTable(record.MerID, "");
                            $('#btnadd').linkbutton('enable');
                            $('#btnedit').linkbutton('enable');
                            $('#btndell').linkbutton('enable');
                            $('#SearchBtn').linkbutton('enable');
                        }
                    });
                }
            });
        }

        //初始化表格 获取对应商户所有包厢
        function initTable(pos, boxname) {
            merid = pos;
            $('#View').datagrid({
                iconCls: 'icon-user',
                loadMsg: '数据加载中...',
                fitColumns: false,
                singleSelect: true,
                nowrap: true,
                autoRowHeight: true,
                striped: true,
                url: '/BoxSet/getbox?merid=' + pos + "&name=" + boxname,
                sortName: 'BoxID',
                sortOrder: 'asc',
                border: true,
                remoteSort: false,
                idField: 'BoxID',
                pageSize: 10,
                pagination: true,
                rownumbers: true,
                columns: [[
                    { field: 'BoxID', title: '包厢ID', sortable: true, hidden: true },
                    { field: 'BoxName', title: '包厢名称' },
                    { field: 'BZ', title: '备注' },

                ]],
                toolbar: '#tb1'
            });
        }

        function SearchBox() {
            boxname = $('#boxname').textbox('getValue');
            initTable(merid, boxname);
        }

        function clear() {
            $("#add_boxname").textbox('setValue', "");
        }
    </script>
</head>
<body style="padding:0;">
    <div style="padding: 5px; background-color: #F4F4F4">
        <div>
            <a>商户：</a>
            <input id="searchMer" value="">
        </div>
    </div>

    <div>
        <table id="View" border="0"></table>
    </div>
    <div id="tb1" style="background-color: #F4F4F4">
        <div style="margin-bottom: 5px">
            <a href="#" id="btnadd" class="easyui-linkbutton" iconcls="icon-add" onclick="AddDialog()" plain="true">新增</a>
            <a href="#" id="btnedit" class="easyui-linkbutton" iconcls="icon-edit" onclick="UpdateDialog()" plain="true">修改</a>
            <a href="#" id="btndell" class="easyui-linkbutton" iconcls="icon-cancel" onclick="DeleteDialog()" plain="true">删除</a>
        </div>
    </div>


</body>
</html>
